package com.woniuxy.platform.core.service.impl;

import com.woniuxy.platform.core.model.PmAdvertising;
import com.woniuxy.platform.core.mapper.PmAdvertisingMapper;
import com.woniuxy.platform.core.service.PmAdvertisingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author gmx
 * @since 2021-07-14
 */
@Service
public class PmAdvertisingServiceImpl extends ServiceImpl<PmAdvertisingMapper, PmAdvertising> implements PmAdvertisingService {

    @Resource
    private PmAdvertisingMapper mapper;

    @Override
    public List<PmAdvertising> selectMH(PmAdvertising pmAdvertising) {
        List<PmAdvertising> list = this.mapper.selectMH(pmAdvertising);
        return list;
    }

    @Override
    public int insert(PmAdvertising pmAdvertising) {
        pmAdvertising.setStatus("未发布");
        int i = this.mapper.insert(pmAdvertising);
        return i;
    }

    @Override
    public int updateStatus(PmAdvertising pmAdvertising) {
        pmAdvertising.setStatus("发布");
        int i = this.mapper.updateById(pmAdvertising);
        return i;
    }

    @Override
    public int updateDisStatus(PmAdvertising pmAdvertising) {
        pmAdvertising.setStatus("未发布");
        int i = this.mapper.updateById(pmAdvertising);
        return i;
    }
}
